<#include "../../head.ftl">
<div class="page_title">客户流失管理</div>
<div class="button_bar">
    <button class="common_button" onclick="help('');">帮助</button>
    <button class="common_button" onclick="document.forms[0].submit();">查询</button>
</div>
<form action="${url}" method="get">
    <table class="query_form_table">
        <tr>
            <th>客户</th>
            <td><input type="text" name="customer.name" value=""/></td>
            <th>客户经理</th>
            <td><input type="text" name="customer.managerUser.name" value=""/></td>
            <th>状态</th>
            <td>
                <select name="status">
                    <option value="">全部</option>
                    <option value="0">预警</option>
                    <option value="1">暂缓流失</option>
                    <option value="2">确认流失</option>
                </select>
            </td>
        </tr>
    </table>
    <br/>
    <input type="hidden" id="number" name="number" value=""/>
</form>
<table class="data_list_table">
    <tr>
        <th>编号</th>
        <th>客户</th>
        <th>客户经理</th>
        <th>上次下单时间</th>
        <th>确认流失时间</th>
        <th>状态</th>
        <th>操作</th>
    </tr>

	<#list page.content as runoff>
	    <tr>
            <td class="list_data_number">${runoff.id}</td>
            <td class="list_data_text">${runoff.customer.name}</td>
            <td class="list_data_ltext">${runoff.customer.managerUser.name}</td>
            <td class="list_data_ltext">
            <#if runoff.lasttime?exists>
                ${runoff.lasttime?string("yyyy年MM月dd日")}
            <#else>
				该客户并没有下过单
            </#if>
            </td>
            <td class="list_data_text">
			<#if runoff.status==2>
                ${runoff.losttime?string("yyyy年MM月dd日")}
            <#else>
				该客户还没有确认流失
            </#if>
            </td>
            <td class="list_data_text">
			<#if runoff.status==0>
                流失预警
            <#elseif runoff.status==1>
					暂缓流失
            <#else>
					确认流失
            </#if>
            </td>
            <!--
                如果状态为0的话可以暂缓和直接确认,如果为1则只能确认
            -->
            <td class="list_data_op">
				<#if runoff.status==0>
                    <a href="${base}/runoff/confirm?id=${runoff.id}">
                        <img title="确认流失" src="${base}/images/bt_confirm.gif" class="op_button"/>
                    </a>
                    <a href="${base}/runoff/defer?id=${runoff.id}">
                        <img title="暂缓流失" src="${base}/images/bt_relay.gif" class="op_button"/>
                    </a>
                <#elseif runoff.status==1>
                    <a href="${base}/runoff/confirm?id=${runoff.id}">
                        <img title="确认流失" src="${base}/images/bt_confirm.gif" class="op_button"/>
                    </a>
                </#if>
            </td>
        </tr>
    </#list>
    <tr>
        <th colspan="7" class="pager">
<#include "../../foot.ftl">